import { NoticeService } from './../../../../providers/notice-service';
import { UrlService } from '../../../../providers/url-service';
import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';

@Component({
  selector: 'page-wallet-zhandoumx',
  templateUrl: 'wallet-zhandoumx.html',
})
export class WalletZhanDoumxPage {
  IntegralList;
  constructor(public navCtrl: NavController,
    public navParams: NavParams,
    public url: UrlService,
    public noticeService:NoticeService
  ) {
  
    this.init();
  }

  init() {
    this.GetUserIntegralList(1);
  }

	/**
   * 下拉刷新
   * @param even 
   */
  doRefresh(even) {
    //console.log('下拉刷新');
    //console.log(even);
    setTimeout(() => {
      this.init();
     even.complete();
    }, 2000);
  }

  GetUserIntegralList(pageIndex) {
    this.url.GetUserIntegralList(pageIndex)
      .then(data => {
        if (data.Code == 0) {
          this.IntegralList = data.Data.Items;
        }
      })
      .catch(error=>{
        this.noticeService.showNoticeByToast(1, error.Msg);
      })
  }
  doInfinite(event){
    //console.log('下拉刷新');
    //console.log(event);
    setTimeout(() => {
      this.init();
     // event.complete();
    }, 2000);
  }



}

